package com.sz.biz.logistics.billing.service;

import com.sz.biz.logistics.ord.entity.OrdOrder;
import com.sz.biz.logistics.ord.entity.OrdOrderAddress;
import com.sz.biz.logistics.billing.dto.QuotationCalcObject;
import com.sz.biz.logistics.billing.dto.QuotationCalcResult;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * Function: 订单计价. <br>
 * Date: 2017年04月05日 17:44 <br>
 * Author: wentao.chang
 */
public interface QuotationCalcService {

    /**
     * 计算运单的成本价，暂支持单供应商
     */
    QuotationCalcObject calcOrderCostPrice(String orderNo);

    /**
     * 使用运单号计算销售价
     */
    QuotationCalcObject calcOrderSalePrice(String orderNo, boolean isFromPre);

    /**
     * 计算运单的成本价，暂支持单供应商
     */
    QuotationCalcObject calcOrderCostPrice(OrdOrder ordOrder, OrdOrderAddress orderAddress);

    /**
     * 使用运单号计算销售价  isFromPre是否来自预估费用
     */
    QuotationCalcObject calcOrderSalePrice(OrdOrder ordOrder, OrdOrderAddress orderAddress, boolean isFromPre);

    /**
     * 使用传入的信息计算成本价
     */
    QuotationCalcObject calcCostPrice(String cargoTypeCode,
                                      BigDecimal weight, BigDecimal volume, String unitCode,
                                      String productUid,
                                      String fromCountry, String fromProvince,
                                      String fromCity, String fromArea, String fromStreet,
                                      String fromPostcode,
                                      String toCountry, String toProvince,
                                      String toCity, String toArea, String toStreet,
                                      String toPostcode);

    /**
     * 计算服务的成本
     */
    QuotationCalcObject calcServiceCostPrice(String serviceUid, Date date, int settleMentId,
                                             String cargoTypeCode, BigDecimal weight, BigDecimal volume,
                                             String unitCode,
                                             String fromCountry, String fromProvince,
                                             String fromCity, String fromArea, String fromStreet,
                                             String fromPostcode,
                                             String toCountry, String toProvince,
                                             String toCity, String toArea, String toStreet,
                                             String toPostcode) throws ExecutionException, InterruptedException;


    /**
     * 使用传入的信息计算销售价
     */
    QuotationCalcObject calcOrderSalePrice(int customerId, String cargoTypeCode,
                                           BigDecimal weight, BigDecimal volume,
                                           String unitCode, String productUid,
                                           String fromCountry, String fromProvince,
                                           String fromCity, String fromArea, String fromStreet,
                                           String fromPostcode,
                                           String toCountry, String toProvince,
                                           String toCity, String toArea, String toStreet,
                                           String toPostcode);

    /**
     * 计算产品的销售价
     */
    QuotationCalcObject calcProductSalePrice(int customerId, List<Integer> groupType, String productUid, Date calcDate,
                                             String cargoTypeCode, String currencyCode,
                                             BigDecimal weight, BigDecimal volume, String unitCode, BigDecimal announcePrice,
                                             String fromCountry, String fromProvince, String fromCity,
                                             String fromArea, String fromStreet, String fromPostcode,
                                             String fetchCountry, String fetchProvince, String fetchCity,
                                             String fetchArea, String fetchStreet, String fetchPostcode,
                                             String toCountry, String toProvince, String toCity,
                                             String toArea, String toStreet, String toPostcode,
                                             int startPort, int endPort, List<String> optionServices, boolean isCalcAllOptions,
                                             boolean isTry,
                                             int domainId)
            throws ExecutionException, InterruptedException;

    /**
     * 根据订单号算预估费用，并返回预估费用的值与预估费用的单位
     *
     * @param orderNo 订单号
     * @return object[0]=预估费用。object[1]=预估费用单位
     */
    @Deprecated
    Object[] calcFeeByOrderNo(String orderNo);

    /**
     * 根据传入的运单号查询计费重
     *
     * @param orderNo
     * @return
     */
    QuotationCalcResult calcWaybillFeeWeight(String orderNo);
}
